Skip to content

🐛 fix(py_info): report missing include paths - #182

Merged
gaborbernat merged 4 commits into
tox-dev:mainfrom
darrenhuai:fix/system-include-fallback
Nov 2, 2026
Merged

gaborbernat merged 4 commits into
tox-dev:mainfrom
darrenhuai:fix/system-include-fallback

Conversation

@darrenhuai

@darrenhuai darrenhuai commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

PythonInfo.system_include could return an interpreter's prefix when the include directory was absent. A caller checking whether that path exists could mistake the prefix for installed C headers.

The packaging fallback now runs only when a headers installation path is available. Otherwise, discovery returns the sysconfig include path, which callers can check for existence.

darrenhuai and others added 4 commits October 29, 2026 19:16
… are missing

An interpreter installed without its C headers, such as Ubuntu's python3 without python3-dev, has no include directory.
On Python 3.11 and later system_include then returned the interpreter's prefix, which always exists, so a caller that
checks the path sees an include directory with no headers in it.

The broken packaging fallback joins the parent of the distutils headers path onto the prefix. Without distutils, as on
3.11 and later and on Debian's 3.10, there is no headers path, install_path("headers") is empty and the join gives the
prefix itself. The fallback now only runs when there is a headers path to use, so the missing sysconfig include path
comes back instead. Tests now cover the branch, so it loses its no cover pragma.
@gaborbernat gaborbernat added the bug Something isn't working label Nov 2, 2026
@gaborbernat gaborbernat changed the title 🐛 fix(py_info): stop system_include returning the prefix when headers are missing 🐛 fix(py_info): report missing include paths Nov 2, 2026
@gaborbernat
gaborbernat merged commit ec38506 into tox-dev:main Nov 2, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants